package com.atdel.demo13;


/**
 *@BelongsProject: java_study
 *@BelongsPackage: com.atdel.demo13
 *@Author: Del
 *@CreateTime: 2025-03-12  11:17
 *@Description: TODO
 *@Version: 1.0
 */
public class Customer extends Thread{

    private  Account account;

    // 取款金额
    private double amount;

    public Customer(Account account,double  amount) {
        this.account = account;
        this.amount = amount;
    }
    public Customer(Account account,double  amount, String name) {
        super(name);
        this.account = account;
        this.amount = amount;
    }

    @Override
    public void run() {
        if ("老公".equals(Thread.currentThread().getName())) {
            System.out.println(Thread.currentThread().getName() + "通过存折取款： " + amount + "元");
            account.withdraw(amount);
        } else {
            System.out.println(Thread.currentThread().getName() + "通过银联卡取款： " + amount + "元");
            account.withdraw(amount);
        }
    }
}
